package jmine.tec.rpc.common.serialization;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.persistence.Id;

import org.apache.commons.lang.builder.ToStringBuilder;

import bancosys.tec.persist.bussobj.PersistableBusinessObject;

/**
 * Bean utilizado para testes de serialização.
 * 
 * @author lundberg
 */
public class MockBean extends PersistableBusinessObject {

    private Long id;

    private BigDecimal number;

    private Boolean bool1;

    private boolean bool2;

    private String string;

    private List<String> stringList;

    private List<BigDecimal> numberList;

    private List<Boolean> booleanList;

    private List<MockBean> objectList;

    private Map<String, MockBean> map;

    private Set<MockBean> set;

    /**
     * @return the id
     */
    @Id
    public Long getId() {
        return this.id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the number
     */
    public BigDecimal getNumber() {
        return this.number;
    }

    /**
     * @param number the number to set
     */
    public void setNumber(BigDecimal number) {
        this.number = number;
    }

    /**
     * @return the bool1
     */
    public Boolean getBool1() {
        return this.bool1;
    }

    /**
     * @param bool1 the bool1 to set
     */
    public void setBool1(Boolean bool1) {
        this.bool1 = bool1;
    }

    /**
     * @return the bool2
     */
    public boolean isBool2() {
        return this.bool2;
    }

    /**
     * @param bool2 the bool2 to set
     */
    public void setBool2(boolean bool2) {
        this.bool2 = bool2;
    }

    /**
     * @return the string
     */
    public String getString() {
        return this.string;
    }

    /**
     * @param string the string to set
     */
    public void setString(String string) {
        this.string = string;
    }

    /**
     * @return the stringList
     */
    public List<String> getStringList() {
        return this.stringList;
    }

    /**
     * @param stringList the stringList to set
     */
    public void setStringList(List<String> stringList) {
        this.stringList = stringList;
    }

    /**
     * @return the numberList
     */
    public List<BigDecimal> getNumberList() {
        return this.numberList;
    }

    /**
     * @param numberList the numberList to set
     */
    public void setNumberList(List<BigDecimal> numberList) {
        this.numberList = numberList;
    }

    /**
     * @return the booleanList
     */
    public List<Boolean> getBooleanList() {
        return this.booleanList;
    }

    /**
     * @param booleanList the booleanList to set
     */
    public void setBooleanList(List<Boolean> booleanList) {
        this.booleanList = booleanList;
    }

    /**
     * @return the objectList
     */
    public List<MockBean> getObjectList() {
        return this.objectList;
    }

    /**
     * @param objectList the objectList to set
     */
    public void setObjectList(List<MockBean> objectList) {
        this.objectList = objectList;
    }

    /**
     * @return the map
     */
    public Map<String, MockBean> getMap() {
        return this.map;
    }

    /**
     * @return the set
     */
    public Set<MockBean> getSet() {
        return this.set;
    }

    /**
     * @param map the map to set
     */
    public void setMap(Map<String, MockBean> map) {
        this.map = map;
    }

    /**
     * @param set the set to set
     */
    public void setSet(Set<MockBean> set) {
        this.set = set;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (this.bool1 == null ? 0 : this.bool1.hashCode());
        result = prime * result + (this.bool2 ? 0 : 1);
        result = prime * result + (this.booleanList == null ? 0 : this.booleanList.hashCode());
        result = prime * result + (this.number == null ? 0 : this.number.hashCode());
        result = prime * result + (this.numberList == null ? 0 : this.numberList.hashCode());
        result = prime * result + (this.string == null ? 0 : this.string.hashCode());
        result = prime * result + (this.stringList == null ? 0 : this.stringList.hashCode());
        result = prime * result + (this.map == null ? 0 : this.map.hashCode());
        result = prime * result + (this.set == null ? 0 : this.set.hashCode());
        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (this.getClass() != obj.getClass()) {
            return false;
        }
        MockBean other = (MockBean) obj;
        if (this.bool1 == null) {
            if (other.bool1 != null) {
                return false;
            }
        } else if (!this.bool1.equals(other.bool1)) {
            return false;
        }
        if (this.bool2 != other.bool2) {
            return false;
        }
        if (this.booleanList == null) {
            if (other.booleanList != null) {
                return false;
            }
        } else if (!this.booleanList.equals(other.booleanList)) {
            return false;
        }
        if (this.number == null) {
            if (other.number != null) {
                return false;
            }
        } else if (!this.number.equals(other.number)) {
            return false;
        }
        if (this.numberList == null) {
            if (other.numberList != null) {
                return false;
            }
        } else if (!this.numberList.equals(other.numberList)) {
            return false;
        }
        if (this.objectList == null) {
            if (other.objectList != null) {
                return false;
            }
        } else if (!this.objectList.equals(other.objectList)) {
            return false;
        }
        if (this.string == null) {
            if (other.string != null) {
                return false;
            }
        } else if (!this.string.equals(other.string)) {
            return false;
        }
        if (this.stringList == null) {
            if (other.stringList != null) {
                return false;
            }
        } else if (!this.stringList.equals(other.stringList)) {
            return false;
        }
        if (this.map == null) {
            if (other.map != null) {
                return false;
            }
        } else if (!this.map.equals(other.map)) {
            return false;
        }
        if (this.set == null) {
            if (other.set != null) {
                return false;
            }
        } else if (!this.set.equals(other.set)) {
            return false;
        }
        return true;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
